using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharaMove : MonoBehaviour
{
    public ScoreManager L;
    void Update()
    {
        if (L.Life==0) gameObject.SetActive(false);//若生命值为0，则人物消失
        var target=Camera.main.ScreenToWorldPoint(Input.mousePosition);
        if (target.x<-7.8) target.x=-7.8f;//将人物限制在范围内
        if (target.x>2.5) target.x=2.5f;
        if (target.y<-4.1) target.y=-4.1f;
        if (target.y>4.2) target.y=4.2f;
        target.z=0;
        transform.position=target;
    }
}
